package com.youyi.flymewallpager.ui;

import android.app.WallpaperManager;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.youyi.flymewallpager.R;
import com.youyi.flymewallpager.wallpager.SimpleWallPager;

/**
 * Created by xzp on 16/7/6.
 */
public class UISimpleSettings extends UIBase{
    @Override
    protected int getLayoutRes() {
        return R.layout.activity_simple_settings;
    }

    @Override
    protected void init(Bundle savedInstanceState) {

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.simple_settings,menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if(item.getItemId()==R.id.commit){
            Intent intent = new Intent(
                    WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
            intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT,
                    new ComponentName(this, SimpleWallPager.class));
            startActivity(intent);
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
